﻿using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using System;
using System.Windows.Forms;
using WebAssistant.BusinessLogic;

namespace Assistant
{
    public class Program
    {
        [STAThread]
        public static void Main(string[] args)
        {
            DataAccess.InitializeDatabase();//ʼ

            CreateHostBuilder().Build().RunAsync();

            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormMain());
        }

        public static IHostBuilder CreateHostBuilder() =>
            Host.CreateDefaultBuilder()
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseUrls(("http://*:"+ Shared.Port).ToString());
                    webBuilder.UseStartup<Startup>();
                });
    }
}
